package Error::Hierarchy::Internal::AbstractMethod;

# $Id: AbstractMethod.pm 10101 2005-08-09 16:13:58Z gr $

use warnings;
use strict;


our $VERSION = '0.05';


use base qw(Error::Hierarchy::Internal Class::Accessor);
__PACKAGE__->mk_accessors(qw(method));


use constant default_message => 'called abstract method [%s]';


use constant PROPERTIES => ( 'method' );


sub init {
    my $self = shift;

    # because we call SUPER::init(), which uses caller() to set
    # package, filename and line of the exception, *plus* we don't want
    # to report the abstract method that threw this exception itself,
    # rather we want to report its caller, i.e. the one that called the
    # abstract method. So we use +2.

    local $Error::Depth = $Error::Depth + 2;
    $self->method((caller($Error::Depth))[3]) unless defined $self->method;
    $self->SUPER::init(@_);
}


1;


__END__

{% USE p = PodGenerated %}

=head1 NAME

Error::Hierarchy::Internal::AbstractMethod - for unimplemented methods

=head1 SYNOPSIS

  # the following all do the same:

  sub not_there_yet {
      Error::Hierarchy::Internal::AbstractMethod->throw;
  }

  # or:

  sub not_there_yet {
      Error::Hierarchy::Internal::AbstractMethod->
          throw(method => 'not_there_yet');
  }

  # or:

  use base 'Class::Accessor::Complex';
  __PACKAGE__->mk_abstract_accessors(qw(not_there_yet));

=head1 DESCRIPTION

This class implements an exception that is meant to be thrown when an
unimplemented method is called.

=head1 PROPERTIES

This exception class inherits all properties of L<Error::Hierarchy::Internal>.

It has the following additional property.

=over 4

=item method

Name of the unimplemented method. If it is not given, then the name of the
method that has thrown this exception is taken from the call stack.

=back

=head1 METHODS

=over 4

{% p.write_methods %}

=back

{% p.write_inheritance %}

{% PROCESS standard_pod %}

=cut

